package com.cljh.controller.page;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;

public class Redis {
    @Autowired
    private static StringRedisTemplate stringRedisTemplate;

    //删除缓存
    public static void flushRedis(String key){
        String s = stringRedisTemplate.opsForValue().get(key);
        if (s!=null&&!"".equals(s)){
            stringRedisTemplate.delete(key);
        }
    }
}
